<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/24/024
 * Time: 20:12
 */

namespace app\admin\validate;

class MouldValidate extends \think\Validate
{

    const SCENE_ADD = 'add'; //添加参数
    const SCENE_EDIT = 'edit'; //编辑参数
    const SCENE_REMOVE = 'remove'; //删除参数


    protected $rule = [
        'id' => 'require|number',
        'sort' => 'require|number',
        'name'  =>  'require|max:32',
        'entrance_action'  =>  'require|max:32',
        'model_alias'  =>  'require|max:32',
    ];


    protected $message  = [
        'id.require' => 'ID必须',
        'id.number' => 'ID必须为数字',
        'sort.require' => '排序必须',
        'sort.number' => '排序必须为数字',
        'name.require' => '名称必须',
        'model_alias.require' => '模型必须',
        'entrance_action.require' => '入口必须',
    ];
    
    //场景
    protected $scene  = [
       self::SCENE_ADD => ['name', 'sort', 'model_alias', 'entrance_action'],
       self::SCENE_EDIT => ['id', 'name', 'sort', 'model_alias', 'entrance_action'],
       self::SCENE_REMOVE => ['id'],
    ];


}